"""
配置文件
"""
import redis
import logging


class Config(object):
    DEBUG = True
    SECRET_KEY = "%%&%&^$&^%&*hih"

    # redis连接路径
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379

    # sqlalchemy连接配置
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@127.0.0.1:3306/db_xianmu"

    # 配置session信息
    SESSION_TYPE = "redis"  # 存储类型
    SESSION_KEY_PREFIX = "Session:"  # 设置前缀
    SESSION_USE_SIGNER = True  # 签名存储
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)  # 制定存储位置
    PERMANENT_SESSION_LIFETIME = 3600 * 24 * 2  # 设置session两天有效


class Developer(Config):
    """开发模式"""
    DEBUG = True
    LOG_LV = logging.DEBUG





class Generate(Config):
    """生产模式"""
    DEBUG = False
    LOG_LV = logging.ERROR


config_dict = {
    "developer": Developer,
    "generate": Generate

}
